Dynamic extension of typed functional languages
نویسنده
چکیده
We present a solution to the problem of dynamic extension in statically typed functional languages with type erasure. The presented solution retains the benefits of static checking, including type safety, aggressive optimizations, and native code compilation of components, while allowing extensibility of programs at runtime. Our approach is based on a framework for dynamic extension in a statically typed setting, combining dynamic linking, runtime type checking, first class modules and code hot swapping. We show that this framework is sufficient to allow a broad class of dynamic extension capabilities in any statically typed functional language with type erasure semantics. Uniquely, we employ the full compile-time type system to perform runtime type checking of dynamic components, and emphasize the use of native code extension to ensure that the performance benefits of static typing are retained in a dynamic environment. We also develop the concept of fully dynamic software architectures, where the static core is minimal and all code is hot swappable. Benefits of the approach include hot swappable code and sophisticated application extension via embedded domain specific languages. We instantiate the concepts of the framework via a full implementation in the Haskell programming language: providing rich mechanisms for dynamic linking, loading, hot swapping, and runtime type checking in Haskell for the first time. We demonstrate the feasibility of this architecture through a number of novel applications: an extensible text editor; a plugin-based network chat bot; a simulator for polymer chemistry; and xmonad, an extensible window manager. In doing so, we demonstrate that static typing is no barrier to dynamic extension.
منابع مشابه
Assignments for Applicative Languages
We propose a theoretical framework for adding assignments and dynamic data to functional languages without violating their semantic properties. This differs from semi-functional languages like Scheme and ML in that values of expressions remain static and side-effect-free. A new form of abstraction called observer is designed to encapsulate state-oriented computation from the remaining purely ap...
متن کاملType Dynamic
Even in the most expressive statically-typed languages, there are always programs that will require run-time type information. An example of such a program is the eval function, whose ouput cannot be assigned a type at compile time. Abadi et al. introduce Dynamic values to solve this problem. A Dynamic value is a pair that contains a value and a type tag for that value. The authors also introdu...
متن کاملOnline Type-Directed Partial Evaluation for Dynamically-Typed Languages∗
This article presents an alternative method of type-directed partial evaluation, which is simpler and more efficient than previous methods. Unlike previous methods, it is straightforwardly applicable to functional languages with various powerful type systems. As an extreme instance, this article mainly deals with a dynamically-typed functional language like Scheme. The key idea is to extend pri...
متن کاملScala.js: Type-Directed Interoperability with Dynamically Typed Languages
Interoperability between statically typed and dynamically typed languages is increasingly important, as can be witnessed by the many statically typed languages targeting JavaScript. Interoperating with both the object-oriented and functional features of JavaScript is essential, if only to manipulate the DOM, yet existing languages have very poor support for this. We present Scala.js, a dialect ...
متن کاملA Theory of Tagged Objects
Foundational models of object-oriented constructs typically model objects as records with a structural type. However, many object-oriented languages are class-based; statically-typed formal models of these languages tend to sacrifice the foundational nature of the record-based models, and in addition cannot express dynamic class loading or creation. In this paper, we explore how to model static...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2010